<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path;
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<title>班级列表-云校通-教师</title>
<jsp:include page="/WEB-INF/page/common/_header.jsp"></jsp:include>
<body ontouchstart class="js-jf">
<div class="weui_tab tab-bottom" style="background: #f3eeee;">
	<div class="weui-header bg-blue"> 
  		<div class="weui-header-left"> <a onclick="back()" href="javascript:" class="icon icon-109 f-white">返回</a> </div>
    	<h1 class="weui-header-title">班级列表</h1>
    </div>
	<div class="weui_tab_bd">
       <div class="weui_cells weui_cells_access mt0 mb55" id="studentList">
       </div>
	</div>
</div>
<!--弹窗-->				
<div class="hb_choose type2" style="width: 100%;top: 44px;left:0;">
	<div class="bj">
	</div>
</div>
<!--End弹窗-->
<jsp:include page="/WEB-INF/page/common/_footer.jsp"></jsp:include>
<script type="text/javascript">
	$(function(){
		$(".type2").show();
		$(document).on("click", ".hb_choose .title>li", function(e) {
			$(this).addClass("active").siblings().removeClass("active");
			$(".yng").hide();
			$("#" + $(this).attr("data-key")).show();
    	});
		$(document).on("click", ".list_3 .list_c3", function(e) {
			$("#regTeacher").val($(this).attr("data-name"));
			var dataValue = $(this).attr("data-value");
			$("#regTeacher").attr("data-value", dataValue);
			$(".type2").hide();
			$(".hide_bd1").attr("style", "display: none;");
			$("#totalDetail").show();
			var vy = dataValue.split("-");
			loadStudentList(vy[0], vy[1]);
		});
	    loadClass();
	})
	function loadClass() {
		$.ajax({
	   		url: basePath + "/classList",
	   		type: 'POST',
	   		dataType : "json",
	   		success: function(data) {
	   			if(data != null) {
	   				var html = '<ul class="title">';
	   				for(var i in data) {
	   					var itm = data[i];
	   					if((parseInt("${term.termKey}") - parseInt(itm.grade)) > 3) {
	   						continue;
	   					}
	   					html += '<li class="'+(i == 0 ? "active " : "")+'" data-key="s'+itm.grade+'">'+itm.gradeText+'</li>';
	   				}
	   				html += "</ul>";
	   				for(var i in data) {
	   					var itm = data[i];
	   					if((parseInt("${term.termKey}") - parseInt(itm.grade)) > 3) {
	   						continue;
	   					}
	   					html += '<div class="yng" id="s'+itm.grade+'"><ul class="list_3">';
	   					for(var j in itm.classList) {
	   						var itm1 = itm.classList[j];
	   						var gradeClass = itm1.grade + "-" + itm1.clazz;
	   						html += '<a href="<%=basePath %>/ls/score/report/clazzScore/'+itm1.grade+'/'+itm1.clazz+'"><li><div class="weui_cell_hd list_c3 f-green" data-value="'+gradeClass+'" data-name="'+itm.gradeText+"(" + itm1.clazz +"班)"+'">\
										'+itm1.clazz+'班\
									</div></li></a>';
	   					}
	   					html += '</ul></div>';
	   				}
	   				$(".bj").html(html);
	   				$("#s" + data[0].grade).show();
	   			}
	   		},
	   		error: function(data) {
	   		}
	   	});
	}
</script>
</body>
</html>